﻿@model HotelRegistrationSystem.Models.RegisterModel
@{
    ViewBag.Title = "Register";
}

@using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <div class="row">
        <div class="six columns">
            <h2>Create a new account.</h2>
        </div>
        <div class="six columns hotel-info" style="display:none">
            <h2>Basic hotel information.</h2>
        </div>
    </div>
    <div class="row">
        <div class="six columns">
            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(m => m.UserName)
                    @Html.TextBoxFor(m => m.UserName, new { placeholder = "Username" })
                    @Html.ValidationMessageFor(m => m.UserName)
                </div>
                <div class="six columns">
                    @Html.LabelFor(m => m.IsHotelOwner)
                    @*     TODO: Improve css to be possible to use CheckBoxFor Html method*@
                    <input data-val="true" data-val-required="The Hotel Owner? field is required." 
                           class="regular-checkbox big-checkbox" id="IsHotelOwner" name="IsHotelOwner" 
                           placeholder="Hotel Owner?" type="checkbox" value="true">
                    <label for="IsHotelOwner"></label>
                    <input name="IsHotelOwner" type="hidden" value="false">
                </div>
            </div>
            @Html.LabelFor(m => m.Password)
            <div class="row">
                <div class="six columns">
                    @Html.PasswordFor(m => m.Password, new { placeholder = "Password" })
                    @Html.ValidationMessageFor(m => m.Password)
                </div>
                <div class="six columns">
                    @Html.PasswordFor(m => m.ConfirmPassword, new { placeholder = "Confirm password" })
                    @Html.ValidationMessageFor(m => m.ConfirmPassword)
                </div>
            </div>

            @Html.LabelFor(m => m.Email)
            <div class="row">
                <div class="six columns">
                    @Html.TextBoxFor(m => m.Email, new { placeholder = "Email" })
                    @Html.ValidationMessageFor(m => m.Email)
                </div>
                <div class="six columns">
                    @Html.TextBoxFor(m => m.ConfirmEmail, new { placeholder = "Confirm email" })
                    @Html.ValidationMessageFor(m => m.ConfirmEmail)

                </div>
            </div>

            <label>Names</label>
            <div class="row">
                <div class="four columns">
                    @Html.TextBoxFor(m => m.FirstName, new { placeholder = "First" })
                    @Html.ValidationMessageFor(m => m.FirstName)
                </div>
                <div class="four columns">
                    @Html.TextBoxFor(m => m.MiddleName, new { placeholder = "Middle" })
                    @Html.ValidationMessageFor(m => m.MiddleName)
                </div>
                <div class="four columns">
                    @Html.TextBoxFor(m => m.LastName, new { placeholder = "Last" })
                    @Html.ValidationMessageFor(m => m.LastName)
                </div>
            </div>

            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(m => m.PhoneNumber)
                    @Html.TextBoxFor(m => m.PhoneNumber, new { placeholder = "Phone number" })
                    @Html.ValidationMessageFor(m => m.PhoneNumber)
                </div>
            </div>
        </div>

        <div class="six columns hotel-info" style="display:none">
            <div class="row">
                <div class="six columns">
                    @Html.LabelFor(m => m.FirstName)
                    @Html.TextBoxFor(m => m.FirstName, new { placeholder = "Name of the hotel" })
                    @Html.ValidationMessageFor(m => m.FirstName)
                </div>
            </div>
            @Html.LabelFor(m => m.FirstName)
            <div class="row">
                <div class="six columns">
                    @Html.PasswordFor(m => m.FirstName, new { placeholder = "Password" })
                    @Html.ValidationMessageFor(m => m.FirstName)
                </div>
                <div class="six columns">
                    @Html.PasswordFor(m => m.FirstName, new { placeholder = "Confirm password" })
                    @Html.ValidationMessageFor(m => m.FirstName)
                </div>
            </div>
        </div>
    </div>
    <fieldset>
          @Html.ValidationSummary(true)
        <legend>Terms and Conditions</legend>
        <p style="overflow-x:scroll;">
            <strong>User Agreement</strong><br />
            By using this website you must agree to all the following conditions.<br /><br />
            <strong>Liability</strong><br />
            You acknowledge that we are not a traditional travel agent. Instead, our Site is a venue to allow anyone to offer accommodation, at anytime, from anywhere. You will not hold us responsible for other users' actions or inactions, including things they post. We are not involved in and cannot guarantee the actual transaction between accommodation host and guest or the ability of the host or guest to fulfill any of their commitments.
            We accept no liability for any failure of transmission or storage of any information nor of the accommodation hosts to receive, acknowledge or act on any information transmitted.
            All software is provided in good faith and 'as is'. We accept no liability for faults or defects in the software or its implementation and delivery. We periodically make changes to the software on this site and may do so without giving any prior notification.
            Many of our services including the synchroniser channel management service are dependant upon and interconnected with systems outside of our control. We can in no way guarantee the proper operation of these services and assume no liability for any loss or inconvenience caused by service interuption or malfunction.
            We reserve the right to deny service to hosts users or web sites that are abusing or overloading our servers. Our discretion is final in these matters.
        </p>
        <strong>@Html.ValidationMessageFor(m => m.TermsAndConditionsAccepted, null, new { @class = "error" })</strong>
        <br/>
        <table style="border:none">
            <tr>
                <th>@Html.CheckBoxFor(m => m.TermsAndConditionsAccepted)</th>
                <th>@Html.LabelFor(m => m.TermsAndConditionsAccepted, new { @class = "checkbox" })</th>
            </tr>
        </table>
    </fieldset>
    <input type="submit" value="Register" class="button success" />
}
    
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script>
        $(function () {
            $('#IsHotelOwner').click(function () {
                if (this.checked) {
                    //$(".hotel-info").show();
                }
                else {
                    $(".hotel-info").hide();
                }
            })
        });
 	         (function ($) {
 	             $.validator.unobtrusive.adapters.addBool("booleanrequired", "required");
 	         }(jQuery));
         </script>
}